package org.lztvn.elearning.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lztvn.elearning.entities.Unit;
import org.lztvn.elearning.service.IQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
@Controller
@RequestMapping(value="/course_unit")
@SessionAttributes("userFLogin")
public class CourseUnitController extends AppController {
	@Autowired
    IQuestionService serviceQuest;
	
	@RequestMapping(value="/detail")
	protected ModelAndView handleRequestInternal(Long idCor,Model model,HttpServletRequest req, HttpServletResponse res) throws Exception {
		// TODO Auto-generated method stub
//		return new ModelAndView(new HelloWorldPdfView(),"pdf","dd");
		model.addAttribute("course_id", idCor);
		model.addAttribute("listques", serviceQuest.getlistQuestionbyTestId(2l));
		return new ModelAndView("course_unit");
	}

	@RequestMapping(value="/view")
	protected ModelAndView viewHTML(HttpServletRequest req, HttpServletResponse res) throws Exception {
		// TODO Auto-generated method stub
//		return new ModelAndView(new HelloWorldPdfView(),"pdf","dd");
		return new ModelAndView("view");
	}
}
